#!/usr/bin/perl -w
use 5.010; 

$num = int(1+rand 100);
print "num is $num\n";

while (1) {
print "enter number from 1 to 100\n";
$hum = <STDIN>;
  
  given ($hum) {
  when ($_ eq $num) {
  print "you win\n";
  last;
  } 
  when ($_ =~ /exit|quit/i) {
  last; 
  }
  when ($_ < $num) {
  print "too low\n";
  } 
  when ($_ > $num) {
  print "too high\n";
  }

  }
}

